home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Demos / Component Software / FileFlex 2.0.3.sit / FileFlex 2.0.3 / FileFlex-Director / FileFlex Xtras / -Validation Suite / 00002_performTests.ls < prev    next >
Encoding:
Text File  |  1996-07-21  |  17.6 KB  |  739 lines

  1. on startMovie
  2.   global dgBlueColor, dgYellowColor, dgMonospace, dgMonosize
  3.   put EMPTY into field "mmsg"
  4.   put EMPTY into field "iteration"
  5.   set the text of cast "testName" to EMPTY
  6.   if the machineType = 256 then
  7.     set dgMonospace to "Courier New"
  8.     set dgMonosize to 10
  9.   else
  10.     set dgMonospace to "Monaco"
  11.     set dgMonosize to 9
  12.   end if
  13.   set dgBlueColor to the foreColor of member "blueModel"
  14.   set dgYellowColor to the foreColor of member "yellowModel"
  15.   set dgDkBlueColor to the foreColor of member "dkBlueModel"
  16.   set the textHeight of member "mmsg" to 11
  17.   set the textFont of member "mmsg" to dgMonospace
  18.   set the textSize of member "mmsg" to dgMonosize
  19.   set the foreColor of member "mmsg" to dgYellowColor
  20.   set the textFont of member "testName" to "Helvetica"
  21.   set the textSize of member "testName" to 9
  22.   set the foreColor of member "testName" to dgYellowColor
  23.   put "0" into field "iteration"
  24.   set the textFont of member "iteration" to "Helvetica"
  25.   set the textSize of member "iteration" to 9
  26.   set the foreColor of member "iteration" to dgBlueColor
  27. end
  28.  
  29. on closeWindow
  30.   set theList to the windowList
  31.   repeat with i = 1 to count(theList)
  32.     set theItem to string(getAt(theList, i))
  33.     delete word 1 of theItem
  34.     delete char 1 of theItem
  35.     set theChar to the number of chars in theItem
  36.     delete char theChar - 1 to theChar of theItem
  37.     if (theItem contains "Validation Suite") or (theItem contains "FFVERIF") then
  38.       forget(window theItem)
  39.     end if
  40.   end repeat
  41.   tell the stage
  42.     puppetPalette(0)
  43.   end tell
  44.   tell the stage
  45.     updateStage()
  46.   end tell
  47. end
  48.  
  49. on performTests
  50.   global gDBActive1030, dgBlueColor, dgYellowColor, dgMonospace, dgMonosize, verboseTest
  51.   if gDBActive1030 = "true" then
  52.     set DBResult to DBCloseSession()
  53.     if DBResult < 0 then
  54.       tmsg("==== Session was active.  DBCloseSession reset failed.")
  55.       tFail()
  56.     end if
  57.   end if
  58.   set blueHold to dgBlueColor
  59.   set yellowHold to dgYellowColor
  60.   set monoHold to dgMonospace
  61.   set monoSize to dgMonosize
  62.   clearGlobals()
  63.   set dgBlueColor to blueHold
  64.   set dgYellowColor to yellowHold
  65.   set dgMonospace to monoHold
  66.   set dgMonosize to monoSize
  67.   set verboseTest to 0
  68.   put EMPTY into field "iteration"
  69.   put EMPTY into field "mmsg"
  70.   put DBVersion() & RETURN into field "mmsg"
  71.   set the textFont of member "mmsg" to dgMonospace
  72.   set the textSize of member "mmsg" to dgMonosize
  73.   set the textHeight of member "mmsg" to 11
  74.   set the foreColor of member "mmsg" to dgYellowColor
  75.   set origMasterBytes to the freeBytes
  76.   set origMasterBlock to the freeBlock
  77.   tXtraTest()
  78.   set the textFont of member "testName" to "Helvetica"
  79.   set the textSize of member "testName" to 9
  80.   set the foreColor of member "testName" to dgBlueColor
  81.   set the textFont of member "iteration" to "Helvetica"
  82.   set the textSize of member "iteration" to 9
  83.   set the foreColor of member "iteration" to dgBlueColor
  84.   tGlobalVariables()
  85.   tDBOpenSession()
  86.   tDBCloseSession()
  87.   tDBOpenSessionStressTest()
  88.   tDBOpenSession()
  89.   tDBUse("VIDEO.DBF")
  90.   tDBClose("1")
  91.   tDBDatabaseExists("VIDEO.DBF")
  92.   tDBUse("VIDEO.DBF")
  93.   tDBCloseAll()
  94.   tDBUse("VIDEO.DBF")
  95.   tDBListFields()
  96.   tDBCount()
  97.   tDBBottom()
  98.   tDBCurrRecNum(31)
  99.   tDBTop()
  100.   tDBCurrRecNum(1)
  101.   tDBGo()
  102.   tDBCurrRecNum(18)
  103.   tRetrieveChar()
  104.   tRetrieveNum()
  105.   tRetrieveLogical()
  106.   tRetrieveDate()
  107.   tRetrieveMemo()
  108.   tDBGetCurrRecValG()
  109.   tDBSum()
  110.   tDBCloseAll()
  111.   tDBUse("VIDEO.DBF")
  112.   tDBLocate()
  113.   tDBClose("1")
  114.   tDBUse("VIDEO.DBF")
  115.   tDBCreateIndex()
  116.   tDBCheckIndex()
  117.   tDBReindex()
  118.   tDBSeek()
  119.   tDBClose("1")
  120.   tDBCreate()
  121.   tDBWriteRecG()
  122.   tDBFindMemo()
  123.   tDBZapRecs()
  124.   tDBWriteRecX()
  125.   tDBZapRecs()
  126.   tDBCloseAll()
  127.   tDBEncrypt()
  128.   tDBCreateMany()
  129.   tDBCloseAll()
  130.   tDBWriteRecManyX()
  131.   tDBCloseSession()
  132.   put EMPTY into field "iteration"
  133.   set newBytes to the freeBytes
  134.   set theBytes to origMasterBytes - newBytes
  135.   tmsg("== End of test sequence:")
  136.   tmsg("==== Overall test consumed" && theBytes && "bytes.")
  137.   tmsg("==== The largest contiguous free block at start")
  138.   tmsg("==== was" && origMasterBlock && "bytes.")
  139.   tmsg(EMPTY)
  140.   tmsg("==== The largest contiguous remaining free block")
  141.   tmsg("==== is" && the freeBlock && "bytes.")
  142.   tmsg(EMPTY)
  143.   tmsg(EMPTY)
  144.   put EMPTY into field "iteration"
  145.   set the text of cast "testName" to EMPTY
  146.   beep()
  147. end
  148.  
  149. on tXtraTest
  150.   global dgBlueColor
  151.   put EMPTY into field "iteration"
  152.   set max to field "iterations"
  153.   tTest("Loading of Xtra")
  154.   repeat with i = 1 to max
  155.     set dummy to DBVersion()
  156.     put i into field "iteration"
  157.     set the textFont of member "iteration" to "Helvetica"
  158.     set the textSize of member "iteration" to 9
  159.     set the foreColor of member "iteration" to dgBlueColor
  160.   end repeat
  161.   tPass()
  162. end
  163.  
  164. on tGlobalVariables
  165.   global dgBlueColor, testGlobal1, testGlobal2, theLong, theDouble
  166.   set max to field "iterations"
  167.   put EMPTY into field "iteration"
  168.   tTest("Global Variable Interface")
  169.   set testFail to 0
  170.   repeat with i = 1 to max
  171.     set dummy to DBSetGlobal("testGlobal1", "TestData")
  172.     set dummy to DBSetGlobal("testGlobal2", "Test2Data")
  173.     set theGlob1 to DBGetGlobal("testGlobal1")
  174.     if theGlob1 <> "TestData" then
  175.       tmsg(RETURN & "==== testGlobal1 returned" && theGlob1)
  176.       set testFail to 1
  177.       exit repeat
  178.     end if
  179.     set theGlob2 to DBGetGlobal("testGlobal2")
  180.     if theGlob2 <> "Test2Data" then
  181.       tmsg(RETURN & "==== testGlobal2 returned" && theGlob2)
  182.       set testFail to 1
  183.       exit repeat
  184.     end if
  185.     set theLong to 896
  186.     set theDouble to 493.22000000000002728
  187.     set theLongResult to DBGetGlobal("theLong")
  188.     if theLongResult <> 896 then
  189.       set testFail to 1
  190.       exit repeat
  191.     end if
  192.     set theDoubleResult to DBGetGlobal("theDouble")
  193.     if string(theDoubleResult) <> "493.22" then
  194.       set testFail to 1
  195.       exit repeat
  196.     end if
  197.     put i into field "iteration"
  198.     set the textFont of member "iteration" to "Helvetica"
  199.     set the textSize of member "iteration" to 9
  200.     set the foreColor of member "iteration" to dgBlueColor
  201.   end repeat
  202.   if testFail = 1 then
  203.     tFail()
  204.     exit
  205.   else
  206.     tPass()
  207.   end if
  208. end
  209.  
  210. on tDBOpenSession
  211.   tTest("DBOpenSession")
  212.   set DBResult to DBOpenSession()
  213.   if DBResult = 0 then
  214.     tPass()
  215.   else
  216.     tmsg("== DBOpenSession returned" && DBResult & ".")
  217.     tFail()
  218.     exit
  219.   end if
  220. end
  221.  
  222. on tDBCloseSession
  223.   tTest("DBCloseSession")
  224.   set DBResult to DBCloseSession()
  225.   if DBResult = 0 then
  226.     tPass()
  227.   else
  228.     tmsg("== DBCloseSession returned" && DBResult & ".")
  229.     tFail()
  230.     exit
  231.   end if
  232. end
  233.  
  234. on tDBOpenSessionStressTest
  235.   global dgBlueColor
  236.   tTest("DBOpenSession/DBCloseSession Stress")
  237.   set max to field "iterations"
  238.   put EMPTY into field "iteration"
  239.   repeat with i = 1 to max
  240.     put i into field "iteration"
  241.     set the textFont of member "iteration" to "Helvetica"
  242.     set the textSize of member "iteration" to 9
  243.     set the foreColor of member "iteration" to dgBlueColor
  244.     set DBResult to DBOpenSession()
  245.     if DBResult < 0 then
  246.       tmsg("==== DBOpenSession returned" && DBResult & ".  (failed)")
  247.       tFail()
  248.       exit
  249.     end if
  250.     set DBResult to DBCloseSession()
  251.     if DBResult < 0 then
  252.       tmsg("==== DBCloseSession returned" && DBResult & ".  (failed)")
  253.       tFail()
  254.       exit
  255.     end if
  256.   end repeat
  257.   tPass()
  258. end
  259.  
  260. on tDBUse theFile
  261.   tTest("DBUse")
  262.   if the machineType <> 256 then
  263.     set theDBFile to the moviePath & "Test Data:" & theFile
  264.   else
  265.     set theDBFile to the moviePath & "TESTDATA\" & theFile
  266.   end if
  267.   set videoID to DBUse(theDBFile)
  268.   if videoID < 0 then
  269.     tmsg("==== DBUse returned" && videoID & ".  (failed)")
  270.     tFail()
  271.     exit
  272.   else
  273.     tPass()
  274.   end if
  275. end
  276.  
  277. on tDBClose videoID
  278.   tTest("DBClose")
  279.   set DBResult to DBClose(videoID)
  280.   if videoID < 0 then
  281.     tmsg("==== DBClose returned" && videoID & ".  (failed)")
  282.     tFail()
  283.     exit
  284.   else
  285.     tPass()
  286.   end if
  287. end
  288.  
  289. on tDBDatabaseExists theFile
  290.   tTest("DBDatabaseExists")
  291.   if the machineType <> 256 then
  292.     set theDBFile to the moviePath & "Test Data:" & theFile
  293.   else
  294.     set theDBFile to the moviePath & "TESTDATA\" & theFile
  295.   end if
  296.   set theID to DBDatabaseExists(theDBFile)
  297.   if theID < 0 then
  298.     tmsg("==== DBDatabaseExists returned" && theID & ".  (failed)")
  299.     tFail()
  300.     exit
  301.   end if
  302.   set theID to DBDatabaseExists("nosuchfile")
  303.   if theID >= 0 then
  304.     tmsg("==== DBDatabaseExists returned" && theID & ".  (failed)")
  305.     tFail()
  306.     exit
  307.   end if
  308.   tPass()
  309. end
  310.  
  311. on tDBCloseAll
  312.   tTest("DBCloseAll on one open database")
  313.   set DBResult to DBCloseAll()
  314.   if DBResult < 0 then
  315.     tmsg("==== DBCloseAll returned" && DBResult & ".  (failed)")
  316.     tFail()
  317.     exit
  318.   else
  319.     tPass()
  320.   end if
  321. end
  322.  
  323. on tDBListFields
  324.   tTest("DBListFields (for one file)")
  325.   set theFields to DBListFields()
  326.   if theFields <> field "videoDBFschema" then
  327.     tFail()
  328.     exit
  329.   else
  330.     tPass()
  331.   end if
  332. end
  333.  
  334. on tDBCount
  335.   tTest("DBCount")
  336.   set theCount to DBCount()
  337.   if theCount <> 31 then
  338.     tFail()
  339.     exit
  340.   else
  341.     tPass()
  342.   end if
  343. end
  344.  
  345. on tDBBottom
  346.   tTest("DBBottom")
  347.   set theResult to DBBottom()
  348.   if theResult < 0 then
  349.     tmsg("==== DBBottom returned" && theResult & ".  (failed)")
  350.     tFail()
  351.     exit
  352.   else
  353.     tPass()
  354.   end if
  355. end
  356.  
  357. on tDBCurrRecNum theNum
  358.   tTest("DBCurrRecNum")
  359.   set theResult to DBCurrRecNum()
  360.   if theResult <> theNum then
  361.     tFail()
  362.     exit
  363.   else
  364.     tPass()
  365.   end if
  366. end
  367.  
  368. on tDBTop
  369.   tTest("DBTop")
  370.   set theResult to DBTop()
  371.   if theResult < 0 then
  372.     tmsg("==== DBTop returned" && theResult & ".  (failed)")
  373.     tFail()
  374.     exit
  375.   else
  376.     tPass()
  377.   end if
  378. end
  379.  
  380. on tDBLocate
  381.   tTest("DBLocate")
  382.   set theResult to DBTop()
  383.   set DBResult to DBLocate("TITLE = 'GHOSTBUSTERS'")
  384.   if DBResult <> 0 then
  385.     tFail()
  386.   else
  387.     if DBCurrRecNum() <> 21 then
  388.       tFail()
  389.     else
  390.       tPass()
  391.     end if
  392.   end if
  393.   set dummy to DBTop()
  394. end
  395.  
  396. on tDBGo
  397.   tTest("DBGo")
  398.   set theResult to DBGo(18)
  399.   if theResult < 0 then
  400.     tmsg("==== DBGo returned" && theResult & ".  (failed)")
  401.     tFail()
  402.     exit
  403.   else
  404.     tPass()
  405.   end if
  406. end
  407.  
  408. on tRetrieveChar
  409.   tTest("Retrieve Character (C) field")
  410.   set theResult to DBGetFieldByName("TITLE")
  411.   if theResult <> "A NIGHTMARE ON ELM STREET" then
  412.     tFail()
  413.     exit
  414.   else
  415.     tPass()
  416.   end if
  417. end
  418.  
  419. on tRetrieveNum
  420.   tTest("Retrieve Numeric (N) field")
  421.   set theResult to DBGetFieldByName("COST_BUY")
  422.   if theResult <> 29.94999999999999929 then
  423.     tFail()
  424.     exit
  425.   else
  426.     tPass()
  427.   end if
  428. end
  429.  
  430. on tRetrieveLogical
  431.   tTest("Retrieve Logical (L) field")
  432.   set theResult to DBGetFieldByName("AVAILABLE")
  433.   if theResult <> "F" then
  434.     tFail()
  435.     exit
  436.   else
  437.     tPass()
  438.   end if
  439. end
  440.  
  441. on tRetrieveDate
  442.   tTest("Retrieve Date (D) field")
  443.   set theResult to DBGetFieldByName("DATE_ARRIV")
  444.   if theResult <> "19860314" then
  445.     tFail()
  446.     exit
  447.   else
  448.     tPass()
  449.   end if
  450. end
  451.  
  452. on tRetrieveMemo
  453.   tTest("DBGetMemo")
  454.   set theResult to DBGetMemo("DESCRIPT")
  455.   if theResult <> the text of cast "testMemoData" then
  456.     tFail()
  457.     exit
  458.   else
  459.     tPass()
  460.   end if
  461. end
  462.  
  463. on tDBSum
  464.   tTest("DBSum")
  465.   set fp to the floatPrecision
  466.   set the floatPrecision to 2
  467.   set theResult to DBSum("COST_RENT")
  468.   if theResult <> 98.95000000000000284 then
  469.     tFail()
  470.   else
  471.     set theResult to DBSum("COST_BUY")
  472.     if theResult <> 984.51999999999998181 then
  473.       tFail()
  474.     else
  475.       tPass()
  476.     end if
  477.   end if
  478.   set the floatPrecision to fp
  479. end
  480.  
  481. on tDBGetCurrRecValG
  482.   global title, COST_BUY, AVAILABLE, DATE_ARRIV, DESCRIPT
  483.   tTest("DBGetCurrRecVal(G)")
  484.   set theResult to DBGetCurrRecVal("G")
  485.   if title <> "A NIGHTMARE ON ELM STREET" then
  486.     tmsg("==== DBGetCurrRecVal(G) character data mismatch.  (failed)")
  487.     tFail()
  488.     exit
  489.   end if
  490.   if COST_BUY <> 29.94999999999999929 then
  491.     tmsg("==== DBGetCurrRecVal(G) numeric data mismatch.  (failed)")
  492.     tFail()
  493.     exit
  494.   end if
  495.   if AVAILABLE <> "F" then
  496.     tmsg("==== DBGetCurrRecVal(G) logical data mismatch.  (failed)")
  497.     tFail()
  498.     exit
  499.   end if
  500.   if DATE_ARRIV <> "19860314" then
  501.     tmsg("==== DBGetCurrRecVal(G) date data mismatch.  (failed)")
  502.     tFail()
  503.     exit
  504.   end if
  505.   if DESCRIPT <> the text of cast "testMemoData" then
  506.     tmsg("==== DBGetCurrRecVal(G) memo data mismatch.  (failed)")
  507.     tFail()
  508.     exit
  509.   end if
  510.   tPass()
  511. end
  512.  
  513. on tDBCreate
  514.   tTest("DBCreate")
  515.   set schema to "CHAR_FLD,C,25"
  516.   put RETURN & "NUM_FLD,N,8,3" after schema
  517.   put RETURN & "MEMO_FLD,M" after schema
  518.   set theDBFile to the moviePath & "TEST01"
  519.   if the machineType <> 256 then
  520.     set theDBFile to the moviePath & "Test Data:TEST01"
  521.   else
  522.     set theDBFile to the moviePath & "TESTDATA\TEST01"
  523.   end if
  524.   set DBResult to DBCreate(theDBFile, 3, schema, "false")
  525.   if DBResult < 0 then
  526.     tmsg("==== dbResult returned" && DBResult & ".  (failed)")
  527.     tFail()
  528.     exit
  529.   end if
  530.   set DBResult to DBCloseAll()
  531.   if DBResult < 0 then
  532.     tmsg("==== DBCloseAll returned" && DBResult & ".  (failed)")
  533.     tFail()
  534.     exit
  535.   end if
  536.   set videoID to DBUse(theDBFile)
  537.   if videoID < 0 then
  538.     tmsg("==== DBUse returned" && videoID & ".  (failed)")
  539.     tFail()
  540.     exit
  541.   end if
  542.   set theFields to DBListFields()
  543.   set fieldCheck to "3" & RETURN & "CHAR_FLD,C,25,0"
  544.   put RETURN & "NUM_FLD,N,8,3" after fieldCheck
  545.   put RETURN & "MEMO_FLD,M,10,0" & RETURN after fieldCheck
  546.   if theFields <> fieldCheck then
  547.     tmsg("==== DBCreate's fields don't match .  (failed)")
  548.     tFail()
  549.     exit
  550.   end if
  551.   tPass()
  552. end
  553.  
  554. on tDBWriteRecG
  555.   global dgBlueColor, CHAR_FLD, NUM_FLD, MEMO_FLD
  556.   set max to field "iterations"
  557.   put EMPTY into field "iteration"
  558.   tTest("DBWriteRec(G)")
  559.   repeat with i = 1 to max
  560.     set the textFont of member "iteration" to "Helvetica"
  561.     set the textSize of member "iteration" to 9
  562.     set the foreColor of member "iteration" to dgBlueColor
  563.     put i into field "iteration"
  564.     set NUM_FLD to string(integer(i))
  565.     set CHAR_FLD to "Loop [" & integer(i) & "]"
  566.     set MEMO_FLD to "[" & integer(i) & "]" && the text of cast "testMemoData"
  567.     set theRec to DBCurrRecNum() + 1
  568.     set DBResult to DBWriteRec("G", theRec)
  569.     if DBResult < 0 then
  570.       tmsg("==== DBWriteRec(G) returned" && DBResult & ".  (failed)")
  571.       tFail()
  572.       exit
  573.     end if
  574.   end repeat
  575.   set numRecs to DBCount()
  576.   if numRecs <> max then
  577.     tmsg("==== DBWriteRec(G) had wrong total record count.  (failed)")
  578.     tFail()
  579.     exit
  580.   end if
  581.   repeat with i = max down to 1
  582.     put integer(i) into field "iteration"
  583.     set DBResult to DBGo(i)
  584.     if DBResult < 0 then
  585.       tmsg("==== DBGo returned" && DBResult & ".  (failed)")
  586.       tFail()
  587.       exit
  588.     end if
  589.     set CHAR_FLD to EMPTY
  590.     set NUM_FLD to EMPTY
  591.     set MEMO_FLD to EMPTY
  592.     set DBResult to DBGetCurrRecVal("G")
  593.     set NUM_FLDx to i
  594.     set CHAR_FLDx to "Loop [" & integer(i) & "]"
  595.     set MEMO_FLDx to "[" & integer(i) & "]" && the text of cast "testMemoData"
  596.     if NUM_FLDx <> NUM_FLD then
  597.       tmsg(EMPTY)
  598.       tmsg("==== Numeric data retrieval mismatch.  (failed)")
  599.       tmsg("==== NUM_FLD is [" & NUM_FLD & "].")
  600.       tmsg("==== NUM_FLD should be [" & NUM_FLDx & "].")
  601.       tFail()
  602.       exit
  603.     end if
  604.     if CHAR_FLDx <> CHAR_FLD then
  605.       tmsg("==== Character data retrieval mismatch.  (failed)")
  606.       tmsg("==== CHAR_FLD is [" & CHAR_FLD & "].")
  607.       tmsg("==== CHAR_FLD should be [" & CHAR_FLDx & "].")
  608.       tFail()
  609.       exit
  610.     end if
  611.     if MEMO_FLDx <> MEMO_FLD then
  612.       tmsg("==== Memo data retrieval mismatch.  (failed)")
  613.       tFail()
  614.       exit
  615.     end if
  616.   end repeat
  617.   tPass()
  618. end
  619.  
  620. on tDBFindMemo
  621.   set max to field "iterations"
  622.   if max > 20 then
  623.     tTest("DBFindMemo")
  624.     set DBResult to DBTop()
  625.     set searchStr to "[18] Starring"
  626.     set DBResult to DBFindMemo("MEMO_FLD", searchStr)
  627.     if DBResult < 0 then
  628.       tFail()
  629.     else
  630.       if DBCurrRecNum() <> 18 then
  631.         tFail()
  632.       else
  633.         tPass()
  634.       end if
  635.     end if
  636.   end if
  637. end
  638.  
  639. on tDBZapRecs
  640.   put EMPTY into field "iteration"
  641.   tTest("DBZapRecs")
  642.   set theCount to DBCount()
  643.   if theCount <> field "iterations" then
  644.     tmsg("==== Incorrect record count.  (failed)")
  645.     tFail()
  646.     exit
  647.   end if
  648.   set DBResult to DBZapRecs(1, theCount)
  649.   if DBResult < 0 then
  650.     tFail()
  651.     exit
  652.   end if
  653.   tPass()
  654. end
  655.  
  656. on tDBEncrypt
  657.   tTest("DBEncrypt/DBDecrypt")
  658.   set theS to "This is a test"
  659.   set theEncryptS to DBEncrypt(theS, "mykey")
  660.   set theS2 to DBDecrypt(theEncryptS, "mykey")
  661.   if theS <> theS2 then
  662.     tFail()
  663.   else
  664.     tPass()
  665.   end if
  666. end
  667.  
  668. on tDBCreateIndex
  669.   tTest("DBCreateIndex")
  670.   if the machineType <> 256 then
  671.     set theDBFile to the moviePath & "Test Data:VIDNAME"
  672.   else
  673.     set theDBFile to the moviePath & "TESTDATA\VIDNAME"
  674.   end if
  675.   set indexID to DBCreateIndex(theDBFile, "UPPER(TITLE)", "0", "0")
  676.   if indexID < 0 then
  677.     tFail()
  678.   else
  679.     set DBResult to DBCloseIndex(indexID)
  680.     if DBResult < 0 then
  681.       tFail()
  682.     else
  683.       tPass()
  684.     end if
  685.   end if
  686. end
  687.  
  688. on tDBCheckIndex
  689.   tTest("DBCheckIndex")
  690.   if the machineType <> 256 then
  691.     set theDBFile to the moviePath & "Test Data:VIDNAME"
  692.   else
  693.     set theDBFile to the moviePath & "TESTDATA\VIDNAME"
  694.   end if
  695.   set indexID to DBUseIndex(theDBFile)
  696.   if indexID < 0 then
  697.     tFail()
  698.   else
  699.     set DBResult to DBCheckIndex(indexID)
  700.     if DBResult < 0 then
  701.       tmsg("==== Check index result code: " & DBResult)
  702.       tFail()
  703.     else
  704.       set DBResult to DBCloseIndex(indexID)
  705.       if DBResult < 0 then
  706.         tmsg("==== Close index result code: " & DBResult)
  707.         tFail()
  708.       else
  709.         tPass()
  710.       end if
  711.     end if
  712.   end if
  713. end
  714.  
  715. on tDBReindex
  716.   tTest("DBReindex")
  717.   if the machineType <> 256 then
  718.     set theDBFile to the moviePath & "Test Data:VIDNAME"
  719.   else
  720.     set theDBFile to the moviePath & "TESTDATA\VIDNAME"
  721.   end if
  722.   set indexID to DBUseIndex(theDBFile)
  723.   if indexID < 0 then
  724.     tFail()
  725.   else
  726.     set DBResult to DBReindex(indexID)
  727.     if DBResult < 0 then
  728.       tFail()
  729.     else
  730.       set DBResult to DBCloseIndex(indexID)
  731.       if DBResult < 0 then
  732.         tFail()
  733.       else
  734.         tPass()
  735.       end if
  736.     end if
  737.   end if
  738. end
  739.